package calculadora;

/**
 *
 * @author dgarocker
 */
public class RenglonTrans {

  private String[] renglones;
  private double acud;
  private double acuv;
  private double acua;
  private double total;

  public RenglonTrans() {
    this.renglones = new String[29];
    this.acud = 0;
    this.acuv = 0;
    this.acua = 0;
    this.total = 0;
  }

  public double getAcua() {
    return acua;
  }

  public double getAcud() {
    return acud;
  }

  public double getAcuv() {
    return acuv;
  }

  public double getTotal() {
    return total;
  }

  public void setTotal(double total) {
    this.total = total;
  }

  //Se comienza insertar los datos con el indice 2 como ->1 en la tabla de acumulado
  public void inserta(int indice, int daños_vida, double valor) {
    if (indice != -1) {
      if (this.renglones[indice] == null) {
        this.renglones[indice] = String.valueOf(valor);
        if (daños_vida == 0) {
          this.acud += valor;
        } else if (daños_vida == 1) {
          this.acuv += valor;
        } else if (daños_vida == 2) {
          this.acua += valor;
        }

        this.total += valor;
      } else {
        this.renglones[indice] = String.valueOf(valor + Double.parseDouble(this.renglones[indice]));
        if (daños_vida == 0) {
          this.acud += valor;
        } else if (daños_vida == 1) {
          this.acuv += valor;
        } else if (daños_vida == 2) {
          this.acua += valor;
        }
        this.total += valor;
      }
    }
  }

  public void insertaTotal() {
    this.renglones[18] = String.valueOf(this.total);
  }

  public void insetaAcud() {
    this.renglones[19] = String.valueOf(this.acud);
  }

  public void insetaAcuv() {
    this.renglones[20] = String.valueOf(this.acuv);
  }

  public void insetaAcua() {
    this.renglones[21] = String.valueOf(this.acua);
  }

  public void inserta(int indice, String valor) {
    this.renglones[indice] = valor;
  }

  public void inserta(int indice, double valor) {
    if (this.renglones[indice] != null) {
      this.renglones[indice] = String.valueOf(valor + Double.parseDouble(this.renglones[indice]));
    } else {
      this.renglones[indice] = String.valueOf(valor);
    }
  }

  public String[] getRenglones() {
    return renglones;
  }
}